Retrieving the undistorted terahertz time-domain electric-field vector from the electro-optic effect