The affine motion of two-dimensional (2d) incompressible fluids surrounded by vacuum can be reduced to a completely integrable and globally solvable Hamiltonian system of ordinary differential equations for the deformation gradient in SL (2 , R). In the case of perfect fluids, the motion is given by geodesic flow in SL (2 , R) with the Euclidean metric, while for magnetically conducting fluids (MHD), the motion is governed by a harmonic oscillator in SL (2 , R). A complete classification of the dynamics is given including rigid motions, rotating eddies with stable and unstable manifolds, and solutions with vanishing pressure. For perfect fluids, the displacement generically becomes unbounded, as t→ ± ∞. For MHD, solutions are bounded and generically quasi-periodic and recurrent.