Phenomenological Theory of the Deformation of Rotated Octahedra in Perovskites