step 1
the perimeter of square is
P=4b
where b is the length side
we have
b=4x-1
so
P=4(4x-1)
P=16x-4
step 2
The perimeter of rectangle is equal to
P=2(L+W)
we have
L=2x+2
W=2x
substitute
P=2(2x+2+2x)
P=2(4x+2)
P=8x+4
step 3
equate the perimeters
16x-4=8x+4
solve for x
16x-8x=4+4
8x=8
x=1