We describe an x-ray differential phase-contrast imaging method based on two-dimensional transmission gratings that are directly resolved by an x-ray camera. X-ray refraction and diffraction in the sample lead to variations of the positions and amplitudes of the grating fringes on the camera. These effects can be quantified through spatial harmonic analysis. The use of 2D gratings allows differential phase contrast in several directions to be obtained from a single image. When compared to previous grating-based interferometry methods, this approach obviates the need for multiple exposures and separate measurements for different directions and thereby accelerates imaging speed.