Motion remains a major challenge in MRI. Many motion-corrected reconstruction methods are available, yet models are often simplified. We propose image-space gridding that resamples images onto arbitrary grids, which provides a pair of operators that represents the forward and adjoint of a nonrigid transform. This allows existing nonrigid image registration techniques to be incorporated into model-based reconstructions. We apply this method to correct for respiratory motion in free-breathing cardiac MRI. Data from individual heartbeats are binned to reconstruct image-based self-navigators. Nonrigid motion is estimated using a diffeomorphic demons algorithm, and corrected by solving an optimization problem with image-space gridding operators.