A Mathematical Theory of Quantum Sheaf Cohomology