Backtracing particle rays through magnetic spectrometers: avoiding systematic errors in the reconstruction of target coordinates