Probably the simplest is to write a short Python script that creates fills a numpy array with these ROI rectangles (you can use numpy indexing to fill a rectangular region with a value), then save the numpy array into a nrrd file using pynrrd.
Make sure the set origin, spacing, and axis directions of the nrrd file according to the DICOM file’s geometry. If you are not sure how to get this information then you can import the DICOM series into Slicer, save as nrrd, and use the same header.