Accurate geometrical calibration between the scan coordinates and the camera coordinates is critical in four-dimensional scanning transmission electron microscopy (4D-STEM) for both quantitative imaging and ptychographic reconstructions. For atomic-resolved, in-focus 4D-STEM datasets, we propose a hybrid method incorporating two sub-routines, namely a J-matrix method and a Fourier method, which can calibrate the uniform affine transformation between the scan-camera coordinates using raw data, without a priori knowledge of the crystal structure of the specimen. The hybrid method is found robust against scan distortions and residual probe aberrations. It is also effective even when defects are present in the specimen, or the specimen becomes relatively thick. We will demonstrate that a successful geometrical calibration with the hybrid method will lead to a more reliable recovery of both the specimen and the electron probe in a ptychographic reconstruction. We will also show that, although the elimination of local scan position errors still requires an iterative approach, the rate of convergence can be improved, and the residual errors can be further reduced if the hybrid method can be firstly applied for initial calibration. The code is made available as a simple-to-use tool to correct affine transformations of the scan-camera coordinates in 4D-STEM experiments.