In general, to uniformly randomly select a (x,y) from inside a rectangle, you can independently sample the x coordinate and the y coordinate. Note that the rectangle might not be aligned along the axes (i.e. could be at an angle), but one can always find linear transformations to transform the rectangle so that its axes are parallel to the X and Y axes.

Followup 1: If you know the areas of the rectangles, you can first randomly chose one of the rectangle (where the probability of choosing a rectangle is proportional to its area) and then use the previous function to randomly choose a point from within that rectangle.

Followup 2: How is the shape information provided to us ? Do we know the area ?