Permute the entries of the matrix, preserving row and column marginals.
permute_matrix(A)
A
An integer matrix.