Fixed an assumption about the reversibility of flips and rotations.

It is not sufficient to have the number of flips be 0 mod 2 and the
number of rotations be 0 mod 4.  The order these operations are done
in matters, so just recalculate expand_symmetry to find out what we
need to get back to the desired position.