public static byte[] ImageGetSquare(byte[] pixels, int w, int h, int squareSize, int X, int Y) { //grabs square starting at the upper left corner return ImageSubset(pixels, w, h, X * squareSize, Y * squareSize, (X + 1) * squareSize, (Y + 1) * squareSize); }