def add_rect(self, width, height, rid=None):
        """
        Add rectangle of widthxheight dimensions.

        Arguments:
            width (int, float): Rectangle width
            height (int, float): Rectangle height
            rid: Optional rectangle user id

        Returns:
            Rectangle: Rectangle with placemente coordinates
            None: If the rectangle couldn be placed.
        """
        assert(width > 0 and height >0)

        # Search best position and orientation
        rect, _ = self._select_position(width, height)
        if not rect:
            return None
        
        # Subdivide all the max rectangles intersecting with the selected 
        # rectangle.
        self._split(rect)
    
        # Remove any max_rect contained by another 
        self._remove_duplicates()

        # Store and return rectangle position.
        rect.rid = rid
        self.rectangles.append(rect)
        return rect