Utility method to view submatrices
Your solution seems to work fine fine for square matrix(where n = m). However, when presented with non-square matrix, the result becomes purely sporadic. This may or may not be problematic, depending on which kind of matrix you have to deal with.
Modulo % is quite expensive.
You are copying the array item by item. It is not the best way to it, especially when you are copying a continuous section within an array (where m &gt; 1)
You should cache the result of values.GetLength(0), and more importantly values[0].GetLength(0), as they are expensive.




public static IEnumerable&lt;T[,]&gt; ViewAsNByM2&lt;T&gt;(this T[,] values, int n, int m)
{
    int height = values.GetLength(0), width = values.GetLength(1);
    int rows = height / n, columns = width / m;

    for (int row = 0; row &lt; rows; row++)
    {
        for (int column = 0; column &lt; columns; column++)
        {
            var matrix = new T[n, m];
            for (int i = 0; i &lt; n; i++)
            {
                Array.ConstrainedCopy(
                    values, (row * n + i) * width + column * m,
                    matrix, i * m,
                    m);
            }
            yield return matrix;
        }
    }
}