Scanning probe microscopy (SPM) is ubiquitous in nanoscale science allowing the observation of features in real space down to the angstrom resolution. The scanning nature of SPM, wherein a sharp tip rasters the surface during which a physical setpoint is maintained via a control feedback loop, often implies that the image is subject to drift effects, leading to distortion of the resulting image. While there are in-operando methods to compensate for the drift, correcting the residual linear drift in obtained images is often neglected. In this paper, we present a reciprocal space-based technique to compensate the linear drift in atomically-resolved scanning probe microscopy images without distinction of the fast and slow scanning directions; furthermore this method does not require the set of SPM images obtained for the different scanning directions. Instead, the compensation is made possible by the a priori knowledge of the lattice parameters. The method can also be used to characterize and calibrate the SPM instrument.