Let me describe first how to solve this problem without precomputation, then I'll describe how to make use of precomputation. I'll focus on the unweighted case (each point has weight 1); all the ideas should extend to the weighted case straightforwardly.
Here is an algorithm without precomputation: Use a sweep line. Think of sweeping a vertical line from left to right. This line represents the right edge of the rectangle. The set of possible values for this sweep line will be the set of possible $x$-value of some point, so we only need to consider $O(n)$ locations of the sweep line. Imagine that it starts at the left and slowly moves rightward.
The one thing we don't know is the $y$-value of the bottom edge of the rectangle; call it $b$ (for "bottom"). However, for any specific position of the sweep line, we can build a data structure that counts the number of points in the rectangle with bottom $b$, for all $b$ (i.e., that maps from the value of $b$ to the number of points if the rectangle's bottom edge is $b$ units above the axis, and the right edge coincides with the sweep line). I suggest you use an interval tree to represent this data structure. There are $O(n)$ possible values for $b$, and thus $O(n)$ intervals in the interval tree. When we move the sweep line right, we might need to add or remove one interval from the interval tree. When the sweep line hits a new point $(x_i,y_i)$, we add a new interval to the tree for the interval $[y_i,y_i+h]$ (where $h$ is the height of the rectangle). When the sweep line hits $w$ units to the right of the point $(x_i,y_i)$, i.e., the sweep line hits $x=x_i+w$, then we delete the interval $[y_i,y_i+h]$ from the interval tree. For each location of the sweep line, we can also use the interval tree to efficiently find the rectangle that covers the most points and has its right edge coincide with the sweep line; doing that for each possible location of the sweep line gives us the optimum rectangle.
The running time of this algorithm is $O(n \lg n)$. Each insertion/deletion can be done in $O(\lg n)$ time, and we do $O(n)$ insertions and deletions, so the whole thing can be done in $O(n \lg n)$ time.
What about precomputation? Well, if we are given the width $w$ and height $h$ of the rectangle in advance, along with the set of points, then we can build all of the interval trees. Naively, it sounds like we need to store $O(n)$ interval trees, each of size $O(n)$, for a total of $O(n^2)$ space -- but one can do better. We can reduce this to $O(n \lg n)$ space in total by using persistent data structures. It is straightforward to build a persistent version of the interval tree data structure, using standard methods.
Once you've done the precomputation, given any vertical line representing the right edge of the rectangle, you can efficiently find the best rectangle that coincides with that right edge (in $O(1)$ time). (Actually, you don't need persistent data structures for that: since there are only $O(n)$ possible queries, you can just record the answer for each possible query.) I don't know if this is what you are looking for, though, as I found your question hard to understand (it was hard for me to tell what is available during precomputation and what is made available later for each query).