A quadratic refinement of the Grothendieck-Lefschetz-Verdier trace formula