def MergeBounds(bounds1, bounds2):
  """Merge two rectangles to create minimum rectangle that contains both.

  Args:
    bounds1:  List of lower left and upper right boundary of first rectangle.
    bounds2:  List of lower left and upper right boundary of second rectangle.
  Returns:
    List of lower left and upper right boundary containing both rectangles.
  """
  new_bounds = []
  if bounds1[0] < bounds2[0]:
    new_bounds.append(bounds1[0])
  else:
    new_bounds.append(bounds2[0])

  if bounds1[1] < bounds2[1]:
    new_bounds.append(bounds1[1])
  else:
    new_bounds.append(bounds2[1])

  if bounds1[2] > bounds2[2]:
    new_bounds.append(bounds1[2])
  else:
    new_bounds.append(bounds2[2])

  if bounds1[3] > bounds2[3]:
    new_bounds.append(bounds1[3])
  else:
    new_bounds.append(bounds2[3])

  return new_bounds