Given a set of bounding boxes, write a function to calculate the Intersection over Union (IoU) and perform Non-Maximum Suppression (NMS).