A rectangular painting has an area of 36 square feet and a perimeter of 24 feet. What are the dimensions of the painting?