A class of homogenization problems in the calculus of variations