Non-adiabatic quantum evolution: The S matrix as a geometrical phase factor