Quantum error-correcting codes are constructed that embed a finite-dimensional code space in the infinite-dimensional Hilbert space of a system described by continuous quantum variables. These codes exploit the noncommutative geometry of phase space to protect against errors that shift the values of the canonical variables q and p. In the setting of quantum optics, fault-tolerant universal quantum computation can be executed on the protected code subspace using linear optical operations, squeezing, homodyne detection, and photon counting; however, nonlinear mode coupling is required for the preparation of the encoded states. Finite-dimensional versions of these codes can be constructed that protect encoded quantum information against shifts...