permuteGrid function

Permute rows, columns or whole grid matrix.