Updated for rotation of shapes