Grating interferometers with high accuracy, strong robustness and multi-dimensional measurement ability have become a main approach in ultra-precision positioning. However, the installation errors, especially the nonideal rotation and translation of the grating, will affect the phase of diffraction beam, resulting in displacement calculation errors. In this paper, a common phase variation model of grating interferometer regarding to the mechanical errors is proposed. A simplified geometric model of general grating interferometers base on the principle of optical-path-unfolding is first established for convenience and universality. Optical path tracing algorithm and the ray vector analysis method are adopted to analyze the phase variations due to optical-path length change and Doppler effect. The experiment results indicate that when the grating moves 100 mm in X-direction with a rotation of 100 arcseconds around Y-axis, a non-linear error of 11.4 nm is generated. For deflection angles of 300 arcseconds around three axes, cross-talk errors between translation axes will reach 45.6 µm in a range of 30 mm for the measurement system illustrated. The Unfolding-Based model proposed in this paper can be applied to most of the grating interferometers. Calculation errors can be effectively quantified through the model and algorithm, which provide a reference for the optimization of optical path as well as the design of calibration algorithm. The results further improve the necessity of six degree-of-freedom measurement ability in ultra-precision positioning.