One rectangle has a length of 4x+2 and a width of 2x. A square has side lengths that are 4x. If the perimeter of the rectangle and the square are equal, what are the dimensions of the square?