Based on the analysis of second-order moments, a generalized canonical representation of a two-dimensional optical signal is proposed, which is associated with the angular Poincaré sphere. Vortex-free (or zero-twist) optical beams arise on the equator of this sphere, while beams with a maximum vorticity (or maximum twist) are located at the poles. An easy way is shown how the latitude on the sphere, which is a measure for the degree of vorticity, can be derived from the second-order moments. The latitude is invariant when the beam propagates through a first-order optical system between conjugate planes. To change the vorticity of a beam, a system that does not operate between conjugate planes is needed, with the gyrator as the prime representative of such a system. A direct way is derived to find an optical system (consisting of a lens, a magnifier, a rotator, and a gyrator) that transforms a beam with an arbitrary moment matrix into its canonical form.