FOR I = 1 TO N loop through all the map rows Crow = N2 + CC[I] factor N2 to move the center point Srow = N2 - SS[I] note the minus sign FOR J = 1 TO N loop through all the map columns Xrot = Crow + SS[J] Yrot = Srow + CC[J] output_map[Xrot][Yrot] = input_map[I][J]