In a drawing document, rectangles have separate borders and center areas, which can be turned on/off and set to sizes and patterns and colors independently, and you can move layers forward and backward to put one shape in front of or behind another shape. That's why I use drawing documents even when my goal is mostly painting, since you can embed painting areas inside drawing documents.
Nevertheless, let's discuss what you asked. In a painting document, you are putting pixels on top of other pixels, so any rectangle you draw wipes out anything below it. Therefore, you generally want to paint backgrounds (like your frame rectangle) before painting anything that goes on top (inside the frame). Since you already have the inside part painted, here are two choices:
1. Paint your frame in four pieces: the top border as one rectangle, the bottom border as another rectangle, the left border as another rectangle, and the right border as a fourth rectangle. It might be hard to get them to line up perfectly if you are doing this merely by eye-hand. Zooming way in can help.
2. Paint the rectangle elsewhere (in an unused section of your document or even in another painting document). Copy/paste what you want inside the frame on top of it. Then cut/paste the whole thing (frame and contents) back to where you want it.