Interferometer based on four diffraction gratings