Counting lattice points via Hirzebruch–Riemann–Roch