I have lots (billions) of points in 2D which I can preprocess and I would like to answer queries which are of the following form:
Given all four corners of a rectang
A simplification you can make to solve your problem is to find the minimum axis-aligned rectangle (S) containing the one given (R). Use some spatial tree structure as a k-d tree to find the subset of points contained inside S and finally, select for that subset the points that are inside R.
That approach will be way easier to implement than the one proposed by @Dukelin where the k-d tree search is performed directly using R.