function [rectangle]=SelectRegion(displayAxis)
% Select a region from the MODIS map
% Input: axis of displayed data
% Output: rectangle object representing coordinates of selected region

% Do the rrbox command
set(gcf,'Pointer','Crosshair');
waitforbuttonpress;
Pt1 = get(displayAxis,'currentpoint');
rbbox([get(gcf,'currentpoint') 0 0],get(gcf,'currentpoint'));
Pt2 = get(displayAxis,'currentpoint');
rect = [min([Pt1(1,1:2);Pt2(1,1:2)]) abs(Pt2(1,1:2)-Pt1(1,1:2))];
rectangle.y1=floor(rect(1));
rectangle.y2=floor(rect(1)+rect(3));
rectangle.x1=floor(rect(2));
rectangle.x2=floor(rect(2)+rect(4));
rectangle.rect=rect;
set(gcf,'Pointer','arrow');

return
