Constructing a periodic mesh with a varying inclusion

The problem I wish to solve is a homogenization problem on the unit cell on a material that has a square inclusion at the centre with square length 2r and I’m trying to vary r so that the volume fraction 4*r^2 starts at 0, increases in increments of 0.01 until it reaches 1, I want to generate a mesh for each value of r and I want to do it in such a way so that the mesh is periodic on the boundaries.
Here is part of my code, I’m only showing the part with the mesh because once I’ve sorted that out I will be able to do the rest.

from dolfin import *
from mshr import*
#center = dolfin.Point()
#circle = mshr.Circle(center, 1.0)
#mesh = mshr.generate_mesh(circle, 20)
#plot(mesh)
class PeriodicBoundary(SubDomain):

# Left boundary is "target domain" G
def inside(self, x, on_boundary):
    # return True if on left or bottom boundary AND NOT on one of the two corners (0, 1) and (1, 0)
    return bool((near(x[0], 0) or near(x[1], 0)) and 
            (not ((near(x[0], 0) and near(x[1], 1)) or 
                    (near(x[0], 1) and near(x[1], 0)))) and on_boundary)

def map(self, x, y):
    if near(x[0], 1) and near(x[1], 1):
        y[0] = x[0] - 1.
        y[1] = x[1] - 1.
    elif near(x[0], 1):
        y[0] = x[0] - 1.
        y[1] = x[1]
    else:   # near(x[1], 1)
        y[0] = x[0]
        y[1] = x[1] - 1.

pb = PeriodicBoundary()
r = 0.2
#UnitSquare = Rectangle(Point(0, 0), Point(1, 1))
#Inclusion = Rectangle(Point(0.5-r, 0.5-r), Point(0.5+r, 0.5+r))
#Matrix = UnitSquare-Inclusion
#mesh0 = generate_mesh(Inclusion, 10)
#box_tot = Inclusion + Matrix
#mesh = generate_mesh(box_tot, 32)
domain = Rectangle(Point(0, 0), Point(1, 1))
domain.set_subdomain(1, Rectangle(Point(0.5-r, 0.5-r), Point(0.5+r, 0.5+r)))
domain.set_subdomain()