Thank you again Hans… It works but there is one issue with it. I am unable to scale the rectangle to fit the width and height of the viewport. if I group it.
When I group and use zoom the width of the rectangle fits the screen width but the height is not adjusted to fit the screen height and instead it scrolls.
I do not want the rectangle to be scrolling - i wanted the rectangle to fit the height of the screen too.