Dynamics of Totally Constrained Systems. II Quantum Theory