Spontaneous polarization and repolarization in crystals of the perovskite type