Flipping the image rows and columns forming squares with 50x50 pixels size