implement matrix rotation.