def center_text_in_cell(cell_width_px, cell_height_px, text_width_px, text_height_px):
    """
    Centers text in a cell.
    :param cell_width_px: cell width (pixels).
    :param cell_height_px: cell height (pixels).
    :param text_width_px: text width (pixels).
    :param text_height_px: text height (pixels).
    :return: upper left corner of centered area.
    """
    x = int((cell_width_px - text_width_px) / 2)
    y = int((cell_height_px - text_height_px) / 2)
    return x, y