Let V be a real vector space of dimension n and let M⊂V be a lattice. Let P⊂V be an n-dimensional polytope with vertices in M, and let φ:V→\CC be a homogeneous polynomial function of degree d (i.e., an element of \Symd(V∗)). For q∈\ZZ>0 and any face F of P, let Dφ,F(q) be the sum of φ over the lattice points in the dilate qF. We define a generating function Gφ(q,y)∈\QQ[q][y] packaging together the various Dφ,F(q), and show that it satisfies a functional equation that simultaneously generalizes Ehrhart--Macdonald reciprocity and the Dehn--Sommerville relations. When P is a simple lattice polytope (i.e., each vertex meets n edges), we show how Gφ can be computed using an analogue of Brion--Vergne's Euler--Maclaurin summation formula.