Quantum theory of a polarization phase gate in an atomic tripod configuration