Quantum dynamics of a polar rotor acted upon by an electric rectangular pulse of variable duration