The perimeter of the rectangle and the triangle shown are the same. Write an equation to represent this situation, and solve for x. Then, find the perimeter of each shape.