Function for rotating the blocks