Without your image its hard to tell, but I tried your code on a couple matlab builtin images and it seems to work.
if you get an error, you may have more than one bounding box returned from regionprops, then you can use a loop to plot all rectangles
if you don't get an error, but just can't see the rectangle, it may be actually drawn around the entire image. It might happen if the contrast isn't high enough.
in that case, you can try lowering the cutoff intensity you use for im2bw.