Quantum Yang-Mills theory on arbitrary surfaces