Generalized Ehrhart polynomials