Scanning probe microscopy (SPM) has become a common tool in mineralogy but distortion of images complicates interpretation and often limits the amount of information one can extract. Image distortion arises from a discrepancy between the intended and actual scan area caused by relative movement between tip and sample that is additional the intended scanning motion. We present a mathematical model to describe distortion in SPM images and provide a simple algebraic correction method. It uses Fourier periodicities for correcting high-resolution images; for micrometer-scale images, it can use any three non-colinear points that define a feature with known geometry. Observed distortion can be accounted for by two components: drift, the vector that quantifies the shape change of the intended scan area from a square into a parallelogram, and scaling, a constant that describes an isotropic change in dimension of the resulting scan area. The correction restores angular relationships and distances. The method was tested on the mineral graphite. In order to define the most important parameters affecting distortion, we made a sensitivity analysis by systematically varying temperature, scan speed, and time lapsed after the microscope was powered on. Neither drift nor scaling were found to be temperature dependent as such. However, both do depend on the time lapse after imaging begins. After the instrument is powered on, an initial 40 minute period of erratic drift is observed, whereafter drift velocity decreases with time while scaling increases slightly. Temperature variations in the range of 23 to 43 °C have negligible influence on distortion whereas scan speed affects scaling.