Here you go. In fact I didn't need to write it for you — I used the same thing as a luxurious effect on my menu too:
rem menucursor rectangle draw
if mouseclick()=1
if mx=0
mx1=mousex()
my1=mousey()
mx=1
endif
if mx=1
mx2=mousex()
my2=mousey()
endif
ink rgb(0,32,64),1
line mx1,my1,mx1,my2
line mx1,my1,mx2,my1
line mx1,my2,mx2,my2
line mx2,my1,mx2,my2
else
mx1=mx2=mousex()
my1=my2=mousey()
mx=0
endif
Apart from the color of the lines, everything is simple raw qua-sine-non coding for your menu. Excluded features are the cursor and the synchronisation. You just need to copy it in wherever you like in your program.
...If you really meant that. I'm not sure, if it was the thing you're looking for.
Wherever you plan to go,
it's the next step you never know.