The loss of synchronization caused by geometrical modifications of an image, such as cropping, rotation and scaling, increases the difficulty of watermark detection, especially for block-based watermarking schemes. In this research, we consider an algorithm to embed an invisible grid structure into watermarked images to overcome this problem. A fixed-size two-dimensional pseudo-random pattern is repeatedly embedded along horizontal and vertical directions of an image after the watermark is embedded in the image. In watermark detection, the affine matrix as well as horizontal/vertical shifts associated with certain geometrical attacks axe determined by calculating the autocorrelation of the extracted grid structure and the cross-correlation between the folded grid and the embedded pattern. Synchronization is then recovered, and the watermark can be more easily detected. The applicability and advantages of the proposed algorithm axe demonstrated by experimental results.