In the figure shown, two identical squares are inscribed in the rectangle.  If the perimeter of the rectangle is ~$18\sqrt{2}$~, then what is the perimeter of each square?

~$8\sqrt{2}$~

12

~$12\sqrt{2}$~

16

18