Out of plane model for heterogeneous periodic materials: the case of masonry