Drawing a QRectangle in the Red, Green, or Yellow Slice View Windows

In my custom module, the user can adjust the size and position of the image capture of the RGY slice view windows. I would like to implement a button that will show the area to be captured by accessing the QPainter of the slice view window and then drawing a red rectangle in that window.

Here is an example of the script I have been trying to use:
layoutManager = slicer.app.layoutManager()
greenView = layoutManager.sliceWidget(‘Green’).sliceView()
michelangelo = qt.QPainter(greenView)
mPen=qt.QPen(qt.Qt.red)
mPen.setWidth(5)
michelangelo.setPen(mPen)
michelangelo.drawRect(100,100,498,169)
greenView.render()

Nothing shows up after running the code.

I would recommend to draw a rectangle in a slice view using a markup ROI or plane instead.