This is the first in a series of papers exploring the relationship between the Rohlin invariant and gauge theory. We discuss a Casson-type invariant of a 3-manifold Y with the integral homology of the 3-torus, given by counting projectively flat U(2)-connections. We show that its mod 2 evaluation is given by the triple cup product in cohomology, and so it coincides with a certain sum of Rohlin invariants of Y. Our counting argument makes use of a natural action of H^1 (Y;Z_2) on the moduli space of projectively flat connections; along the way we construct perturbations that are equivariant with respect to this action. Combined with the Floer exact triangle, this gives a purely gauge-theoretic proof that Casson's homology sphere invariant reduces mod 2 to the Rohlin invariant.